package cn.t.converter.order;

import cn.t.core.converter.CoreDTOConverter;
import cn.t.dto.device.CargowaySkuDTO;
import cn.t.dto.order.ReplenishmentRecordDTO;
import cn.t.model.device.CargowayDO;
import cn.t.model.order.ReplenishmentRecordDO;
import cn.t.request.OnOffShelfReq;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 后台补货记录表(ReplenishmentRecord)dto转domain
 *
 * @author t
 * @since 2024-05-24 10:19:35
 */
@Mapper(componentModel = "spring")
public interface ReplenishmentRecordDTOConverter extends CoreDTOConverter<ReplenishmentRecordDTO, ReplenishmentRecordDO> {

    @Mapping(target = "rsQty", source = "request.inventory")
    ReplenishmentRecordDO req2ReplenishmentRecord(OnOffShelfReq request, String skuCode, String skuName);

    @Mapping(target = "rsQty", source = "inventory")
    @Mapping(target = "cargowayId", source = "cargoway.id")
    @Mapping(target = "id", ignore = true)
    ReplenishmentRecordDO req2ReplenishmentRecord(CargowayDO cargoway, Integer inventory, String skuCode, String skuName);

    @Mapping(target = "rsQty", source = "inventory")
    @Mapping(target = "cargowayId", source = "cargowaySkuDO.id")
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "gmtCreated", ignore = true)
    @Mapping(target = "gmtModified", ignore = true)
    @Mapping(target = "creator", ignore = true)
    @Mapping(target = "modifier", ignore = true)
    @Mapping(target = "isDeleted", ignore = true)
    ReplenishmentRecordDO dto2ReplenishmentRecord(CargowaySkuDTO cargowaySkuDO, Integer inventory);

}

